package com.laicunba.ext.web.init;

import java.io.File;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import com.laicunba.constant.GloabConstant;
import com.laicunba.util.StringUtil;

public class PropertiesInit {
	static {
		// 加载log4j配置文件
		PropertyConfigurator.configure(System.getProperty("user.home") + File.separator + "laicunba_ext.properties");

		try {
			if (StringUtil.isNotEmpty(GloabConstant.SYS_ERR_FILE)) {
				File file = new File(GloabConstant.SYS_ERR_FILE);
				if (!file.getParentFile().exists()) {
					file.getParentFile().mkdirs();
				}
				if (!file.exists()) {
					file.createNewFile();
				}
				System.setErr(new PrintStream(file));
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	private static final Logger LOG = Logger.getLogger(PropertiesInit.class);

	public static void init() {
		LOG.info("init properties");
	}

	public static Map<String, String> CONSOLE_URI =new HashMap();
}
